package com.sskj.aikeeper.login;

import com.lzy.okgo.model.Response;
import com.sskj.aikeeper.presenter.BasePresenter;
import com.sskj.common.base.HttpData;
import com.sskj.common.util.MD5Util;
import com.sskj.lib.http.JsonCallBack;


/**
 * @author Hey
 * Create at  2019/06/25
 */
class GorgetPosswordPresenter extends BasePresenter<GorgetPosswordActivity> {
    public void forgetPassword(String number,String loginPassword,String nextPassword,String code){
        httpService.forgetPassword(number, MD5Util.getFiveMd5Value(loginPassword),MD5Util.getFiveMd5Value(nextPassword),code)
                .tag(this)
                .execute(new JsonCallBack<HttpData>() {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        mView.forgetPasswordSuccess();
                    }
                });
    }

    public void getForgetCode(String number) {
        httpService.getCode(number,"2")
                .tag(this)
                .execute(new JsonCallBack<HttpData>() {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        mView.forgetCode();
                    }
                });
    }
}
